﻿using System;
using System.Collections.Generic;


using System.IO;
using System.Drawing;
using XQ.RequestOfficeSupplies.DAL.DAL;
using XQ.RequestOfficeSupplies.DAL.Model.Business;
using XQ.RequestOfficeSupplies.DAL.Model.Sys;

namespace XQ.RequestOfficeSupplies.DAL.Model.Business
{
    public class CaseUploadBll
    {
        private readonly UploadDal _upload = new UploadDal();


        /// <summary>
        ///图片转字符串
        /// </summary>
        /// <param name="path">图片路径</param>
        /// <returns></returns>
        public string GetImageString(string path, string fileName)
        {
            try
            {
                Bitmap bmp = new Bitmap(path + fileName);
                MemoryStream ms = new MemoryStream();
                bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
                byte[] arr = new byte[ms.Length];
                ms.Position = 0;
                ms.Read(arr, 0, (int)ms.Length);
                ms.Close();
                bmp.Dispose();
                return Convert.ToBase64String(arr);
            }
            catch (Exception)
            {

                return "";
            }
        }

 

    }
}
